package com.example.mydemo2;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.mydemo2.R;

public class IndexActivity extends AppCompatActivity {
    Context context = IndexActivity.this;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_index);
        ImageView imgTrash =  findViewById(R.id.imageView4);
        TextView tvPersonalCenter = findViewById(R.id.textView8);
        Button btnBusiness = findViewById(R.id.button);
        TextView username = findViewById(R.id.textView7);


        //点击垃圾桶 跳转订单
        imgTrash.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(context, SubmitOrderActivity.class);

                startActivity(intent);

            }
        });

        //商家广场页面
        btnBusiness.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(context, BusinessListRecycleActivity.class);
                startActivity(intent);
            }
        });

        tvPersonalCenter.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(context, PersonalCenterActivity.class);

                startActivity(intent);

            }
        });

        User user = getIntent().getParcelableExtra("user");

        String username2 = user.getUsername();
        username.setText(username2);

    }
}